package hillfly.wifichat.adapter;

/**
 * Created by Administrator on 2017/7/19.
 */

import android.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

import hillfly.wifichat.common.BaseFragment;


public class MyAdapter extends FragmentPagerAdapter {

    private List<String> title;
//    private List<Fragment> views;
    private List<BaseFragment> views;
    public MyAdapter(FragmentManager fm,List<BaseFragment> fragments) {
        super(fm);
        this.views = fragments;
    }
    public MyAdapter(FragmentManager fm, List<String> title, List<BaseFragment> views) {
        super(fm);
        this.title = title;
        this.views = views;
    }

    public BaseFragment getItem2(int position) {
        return views.get(position);
    }

    @Override
    public int getCount() {
        return views.size();
    }


    //配置标题的方法
    @Override
    public CharSequence getPageTitle(int position) {
        return title.get(position);
    }

    @Override
    public android.support.v4.app.Fragment getItem(int position) {
        return new android.support.v4.app.Fragment();
    }
}
